Optimal. Leaf size=73 \[ -\frac {a^2 x}{2}+\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a^2 \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a^2 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3957, 2788,
2717, 2715, 8, 3855, 3852} \begin {gather*} -\frac {2 a^2 \sin (c+d x)}{d}+\frac {a^2 \tan (c+d x)}{d}+\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {a^2 \sin (c+d x) \cos (c+d x)}{2 d}-\frac {a^2 x}{2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2715
Rule 2717
Rule 2788
Rule 3852
Rule 3855
Rule 3957
Rubi steps
\begin {align*} \int (a+a \sec (c+d x))^2 \sin ^2(c+d x) \, dx &=\int (-a-a \cos (c+d x))^2 \tan ^2(c+d x) \, dx\\ &=\frac {\int \left (-2 a^4 \cos (c+d x)-a^4 \cos ^2(c+d x)+2 a^4 \sec (c+d x)+a^4 \sec ^2(c+d x)\right ) \, dx}{a^2}\\ &=-\left (a^2 \int \cos ^2(c+d x) \, dx\right )+a^2 \int \sec ^2(c+d x) \, dx-\left (2 a^2\right ) \int \cos (c+d x) \, dx+\left (2 a^2\right ) \int \sec (c+d x) \, dx\\ &=\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a^2 \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} a^2 \int 1 \, dx-\frac {a^2 \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}\\ &=-\frac {a^2 x}{2}+\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a^2 \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a^2 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(243\) vs. \(2(73)=146\).
time = 0.78, size = 243, normalized size = 3.33 \begin {gather*} \frac {1}{16} a^2 (1+\cos (c+d x))^2 \sec ^4\left (\frac {1}{2} (c+d x)\right ) \left (-2 x-\frac {8 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {8 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {8 \cos (d x) \sin (c)}{d}-\frac {\cos (2 d x) \sin (2 c)}{d}-\frac {8 \cos (c) \sin (d x)}{d}-\frac {\cos (2 c) \sin (2 d x)}{d}+\frac {4 \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}+\frac {4 \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.07, size = 78, normalized size = 1.07
method | result | size |
derivativedivides | \(\frac {a^{2} \left (\tan \left (d x +c \right )-d x -c \right )+2 a^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(78\) |
default | \(\frac {a^{2} \left (\tan \left (d x +c \right )-d x -c \right )+2 a^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(78\) |
risch | \(-\frac {a^{2} x}{2}+\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {i a^{2} {\mathrm e}^{i \left (d x +c \right )}}{d}-\frac {i a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{d}-\frac {i a^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i a^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) | \(144\) |
norman | \(\frac {\frac {a^{2} x}{2}+\frac {3 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {6 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {5 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a^{2} x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {a^{2} x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {a^{2} x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}-\frac {2 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {2 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(186\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 81, normalized size = 1.11 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 4 \, {\left (d x + c - \tan \left (d x + c\right )\right )} a^{2} + 4 \, a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.03, size = 104, normalized size = 1.42 \begin {gather*} -\frac {a^{2} d x \cos \left (d x + c\right ) - 2 \, a^{2} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) + 2 \, a^{2} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + {\left (a^{2} \cos \left (d x + c\right )^{2} + 4 \, a^{2} \cos \left (d x + c\right ) - 2 \, a^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int 2 \sin ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int \sin ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int \sin ^{2}{\left (c + d x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.54, size = 128, normalized size = 1.75 \begin {gather*} -\frac {{\left (d x + c\right )} a^{2} - 4 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) + 4 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {4 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1} + \frac {2 \, {\left (3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 5 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.16, size = 117, normalized size = 1.60 \begin {gather*} \frac {4\,a^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {a^2\,x}{2}+\frac {5\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+6\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-3\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________